package com.SoftwareManage.shiro;

import java.util.Random;

public class SaltUtils {
    /**
     * 生成随机盐的静态方法
     */
    public static String getSalt(int n){
        char[] chars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()".toCharArray();
        StringBuilder sb=new StringBuilder();
        for (int i = 0; i < n; i++) {
            int x=new Random().nextInt(chars.length);
            char aChar=chars[x];
            sb.append(aChar);
        }
        return sb.toString();
    }
    public  void main(String[] args){
        System.out.println(SaltUtils.getSalt(8));
    }
}